﻿@model SportMeetingPlanner.ViewModels.SubscriptionsViewModel
@{
    ViewBag.Title = "Details for " + @Model.Meeting.Title;
}
<br />
<div class="section">
    <table class="listTable" cellspacing="0">
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Title)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Title)
                </div>
            </td>
        </tr>
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Description)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Description)
                </div>
            </td>
        </tr>
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Location)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Location)
                </div>
            </td>
        </tr>
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Date)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Date)
                </div>
            </td>
        </tr>
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Contact)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Contact)
                </div>
            </td>
        </tr>
        <tr>
            <td class="leftColumn">
                <div class="editor-label">
                    @Html.LabelFor(model => model.Meeting.Telephone)
                </div>
            </td>
            <td class="rightColumn">
                <div class="editor-field">
                    @Html.DisplayFor(model => model.Meeting.Telephone)
                </div>
            </td>
        </tr>
        @if (Model.Meeting.UserName == User.Identity.Name)
        {
            <tr>
                <td>
                    <br />
                </td>
                <td>
                </td>
            </tr>
            <tr class="link">
                <td colspan="2">@Html.ActionLink("Edit", "Edit", new { id = Model.Meeting.MeetingId })
                </td>
            </tr>
        }
    </table>
</div>
@if (Model.Subscriptions.Count > 0)
{
    <br />
    <div class="section">
        <table class="listTable" cellspacing="0">
            <tr>
                <td class="headerColumn" colspan="3">
                    Participants
                </td>
            </tr>
            <tr>
                <td class="leftColumn">
                    Name
                </td>
                <td>
                    Persons
                </td>
                <td>
                    Ball
                </td>
            </tr>
            @foreach (var item in Model.Subscriptions)
            {
                <tr>
                    <td class="leftColumn">
                        @item.UserName
                    </td>
                    <td>
                        @item.NrPersons
                    </td>
                    <td>
                        @Html.CheckBox("ball", item.Ball, new { disabled = "disabled" })
                    </td>
                </tr>
                if (item.Comment != null && item.Comment != string.Empty)
                {
                <tr>
                    <td colspan="3">
                        @item.Comment
                    </td>
                </tr>
                }
            }
        </table>
    </div>
}
<br />
<div class="section">
    <table class="listTable" cellspacing="0">
        @if (Model.IsCrtUserSubscribed)
        {
            <tr class="link">
                <td colspan="2">@Html.ActionLink("Edit subscription", "Subscribe", new { id = Model.Meeting.MeetingId })
                </td>
            </tr>
            <tr class="link">
                <td colspan="2">@Html.ActionLink("Withdraw", "Unsubscribe", new { id = Model.Meeting.MeetingId })
                </td>
            </tr>
        }
        else
        {
            <tr class="link">
                <td colspan="2">@Html.ActionLink("Attend", "Subscribe", new { id = Model.Meeting.MeetingId })
                </td>
            </tr>
        }
        <tr class="back">
            <td colspan="2">@Html.ActionLink("Back to List", "Index", new { sportid = Model.Meeting.Sport.SportId })
            </td>
        </tr>
    </table>
</div>
